<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <#include "../common/header.ftl">
</head>
<script>
    $(function () {
        $('#pagination').twbsPagination({
            totalPages:${result.pages},
            startPage:${result.pageNum},
            visiblePages:${result.pageSize},
            first:"首页",
            prev:"上一页",
            next:"下一页",
            last:"莫邪",

        onPageClick:function(event,page){
                $('#currentPage').val(page);
                $("#searchForm").submit();
            }
        });
        
        $(".delBtn").click(function () {
            var pid=$(this).data("pid")
            $.messager.confirm("温馨提示","确定删除吗",function () {
                $.post("/permission/delete.do?id="+pid,function (data) {
                    showMessager(data)
                })
            })
        })

    })

</script>
<body>

<div class="container " style="margin-top: 20px">
    <#include "../common/top.ftl">
    <div class="row">
        <div class="col-sm-3">
        <#include "../common/menu.ftl">
        </div>
        <div class="col-sm-9">
            <div class="row">
                <div class="col-sm-12">
                    <h1 class="page-head-line">权限管理</h1>
                </div>
            </div>
            <!--高级查询--->
            <form class="form-inline" id="searchForm" action="/permission/list.do" method="post">
                <input type="hidden" name="currentPage" id="currentPage" value="1">
                <a href="/permission/reload.do" class="btn btn-success">重新加载权限</a>
            </form>

            <table class="table table-striped table-hover" >
                <thead>
                    <tr>
                        <th>编号</th>
                        <th>权限名称</th>
                        <th>权限编号</th>
                        <th>操作</th>
                    </tr>
                </thead>
                   <#list (result.list)! as entity>
                       <tr>
                           <td>${entity_index}</td>
                           <td>${entity.name}</td>
                           <td>${entity.expression}</td>
                           <td>

                               <a  class="btn btn-danger btn-xs delBtn" data-pid="${entity.id}">
                                   <span class="glyphicon glyphicon-trash"></span>删除
                               </a>
                           </td>
                       </tr>
                   </#list>
            </table>
            <div style="text-align: center;">
                <ul id="pagination" class="pagination"></ul>
            </div>
        </div>
    </div>
</div>
</body>
</html>